<script>
	import Vue from 'vue'
	import store from "./store"
	import {
		SyncCurrentLocation
	} from "./utils/comm.js"
	import http from '@/utils/http.js' //引入请求工具包
	export default {
		onLaunch: function() {
			uni.getSystemInfo({
				success: function(e) {
					// #ifndef MP
					Vue.prototype.StatusBar = e.statusBarHeight;
					if (e.platform == 'android') {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 45;
					};
					// #endif

					// #ifdef MP-WEIXIN || MP-QQ
					Vue.prototype.StatusBar = e.statusBarHeight;
					let capsule = wx.getMenuButtonBoundingClientRect();
					if (capsule) {
						Vue.prototype.Custom = capsule;
						// Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right;
						Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					}
					// #endif		


					// #ifdef MP-ALIPAY
					Vue.prototype.StatusBar = e.statusBarHeight;
					Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
					// #endif

				}
			})

			this.TimingSync();
		},
		onShow: function() {
			console.log('App Show')
			this.$store.dispatch("UserInfoByToken");
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			// async TimingSync() {
			// 	setTimeout(async () => {
			// 		console.log("进行上报地址")
			// 		let location = await SyncCurrentLocation();
			// 		if (location.longitude && location.latitude && store.getters.token) {
			// 			http.PostAsync("/LineUpload/SyncLocation", {
			// 				Longitude: location.longitude,
			// 				Latitude: location.latitude,
			// 			});
			// 			this.TimingSync();
			// 		}
			// 	}, 10000)
			// }
		}
	}
</script>

<style>
	@import "static/font/iconfont.css";
	@import "colorui/main.css";
	@import "colorui/icon.css";

	page {
		background-color: white;
	}

	/*每个页面公共css */

	.bg-theme {
		background-color: #36677e !important;
		color: #ffffff;
	}

	.theme-bg-color {
		background-color: #36677e !important;
		color: #ffffff;
	}

	.theme-color {
		color: #36677e;
	}
	.fixed-bottom {
		position: fixed;
		width: 100%;
	
		padding: 20upx;
		bottom: 0;
		left: 0;
		z-index: 9999;
		background-color: white;
	}

	/*每个页面公共css */
</style>